package com.config;

import com.service.IpService;
import org.lionsoul.ip2region.DbConfig;
import org.lionsoul.ip2region.DbSearcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IpConfig {
    @Value("${ip.setting.url}")
    private String ipDbPath;


    @Bean
    public DbSearcher getIpConfig () {
        DbSearcher searcher = null;
        try {
            DbConfig config = new DbConfig() ;
            searcher = new DbSearcher(config , ipDbPath) ;
        }catch (Exception e) {
            e.printStackTrace();
        }
        return searcher;
    }
}
